package com.group01.community.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.group01.community.entity.ZyOwnerRoom;
import com.group01.community.entity.vo.ZyOwnerRoomVO;
import com.group01.community.entity.vo.ZyOwnerVO;
import com.group01.community.mapper.ZyOwnerRoomMapper;
import com.group01.community.service.ZyOwnerRoomService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 房屋绑定表  服务实现类
 * </p>
 *
 * @author xuxu
 * @since 2025-05-01
 */
@Service
public class ZyOwnerRoomServiceImpl extends ServiceImpl<ZyOwnerRoomMapper, ZyOwnerRoom> implements ZyOwnerRoomService {

    @Autowired(required = false)
    private ZyOwnerRoomMapper zyOwnerRoomMapper;

    @Override
    public IPage<ZyOwnerRoomVO> listAllOwnerRoom(Long current, Long size, String communityName, String roomStatus) {
        Page<ZyOwnerRoomVO> page = new Page<>(current, size);
        page.setOptimizeCountSql(false);
        return zyOwnerRoomMapper.listAllOwnerRoom(page,communityName,roomStatus);
    }

    @Override
    public List<ZyOwnerRoom> getOwnerRoomByRoom(ZyOwnerRoom zyOwnerRoom) {
        return zyOwnerRoomMapper.getOwnerRoomByRoom(zyOwnerRoom);
    }

    @Override
    public void updateRoomStatusByZyOwnerRoomVO(ZyOwnerRoomVO zyOwnerRoomVO) {
        zyOwnerRoomMapper.updateRoomStatusByZyOwnerRoomVO(zyOwnerRoomVO);
    }

    @Override
    public void updateRoomStatusByZyOwner(Long ownerRoomId) {
        zyOwnerRoomMapper.updateRoomStatusByZyOwner(ownerRoomId);
    }
}
